package com.work.straighttalk.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.work.straighttalk.R;
import com.work.straighttalk.bean.Contact;

import butterknife.Bind;

/**
 * Created by dllo on 16/3/3.
 */
public class AppContactsViewHolder extends BaseViewHolder<Contact> {
    @Bind(R.id.sd_contact_avater)
    SimpleDraweeView sdContactAvater;
    @Bind(R.id.tv_contact_name)
    TextView tvContactName;
    @Bind(R.id.tv_contact_status)
    TextView tvContactStatus;
    private OnRecyclerViewClickListener listener;

    public AppContactsViewHolder(Context context, ViewGroup root, OnRecyclerViewClickListener listener) {
        super(context, root, R.layout.item_app_contact);
        this.listener = listener;
    }


    @Override
    public void bindData(final Contact contact) {
        tvContactName.setText(contact.getName());
        tvContactStatus.setText(contact.getStatus());
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != listener) {
                    listener.onRecyclerViewCLick(contact.getName());
                }
            }
        });
    }
}
